from pymilvus import MilvusClient

from core.config import settings
from core.llm import get_embedding_llm

milvus_client = MilvusClient(settings.MILVUS_URL)
embedding_llm = get_embedding_llm()
embedding = embedding_llm.embed_query("TensorFlow.js是什么")
result = milvus_client.search(
    collection_name="teach_platform",
    data=[embedding],
    output_fields=["content"],
    filter=f"course_id=='1'",
)
# result = milvus_client.query(
#     collection_name="teach_platform",
#     filter="",  # 空 filter 表示查询全部数据
#     output_fields=["*"],  # 输出所有字段
#     limit=1000
# )

print( result)